package com.zg.resource;

import com.zg.entity.Dm;
import com.zg.service.DataSourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.inject.Singleton;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * Created by zg on 2017/4/16.
 */
@Component
@Singleton
@Path("datas")
public class DataHandleResource {

    @Autowired
    private DataSourceService dataSourceService;

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Map<String,Object> getInfo(@QueryParam("id") Integer id){
        Map<String,Object> map = new HashMap<>();
        map.put("id",id);
        return map;
    }

    @GET
    @Path("/dm")
    @Produces(MediaType.APPLICATION_JSON)
    public List<Dm> getInfo(){
        return dataSourceService.list();
    }
}
